home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ARexxTools / ARexx_TTX.lha / Rexx / RunMacro.ttx < prev   
Encoding:
Text File  |  1995-06-04  |  2.0 KB  |  87 lines

  1. /*************************************************************************
  2. * RunMacro.ttx:        Executes the macro in the current file (asks for arguments)
  3. * Author:             Roberto Fabbri, fabbri@dimi.uniud.it
  4. * Distribution:        Copyright 1995 Roberto Fabbri
  5. *            This file is freely distributable provided it is
  6. *            distributed in its entirety.
  7. *
  8. * Version:        $VER: RunMacro.ttx 1.0 (01.06.95)
  9. * Version history:
  10. *               1.0 (01.06.95) Initial Release
  11. * Notes:                The temp assignment MYREXX: is necessary for executing
  12. *                       arexx macros whose path contains spaces. Rx doesn't
  13. *                       execute macros if their file name is contained between
  14. *                       double quotes (nor single quotes) :(.
  15. **************************************************************************/
  16.  
  17.  
  18. OPTIONS RESULTS
  19.  
  20. CALL TellUser("Executing Current File")
  21.  
  22. GetScreenInfo
  23.  
  24. PARSE VAR RESULT dum dum width dum dum dum dum '"' screenname '"' .
  25.  
  26. outwin = '"CON:50/100/' || width || '/150/Executing ARexx Macro/Screen ' || screenname || '/Close/WAIT"'
  27.  
  28. GetFilePath
  29.  
  30. IF RC ~= 0 THEN DO
  31.     CALL ReportError("Cannot locate this file's path")
  32.     EXIT 5
  33. END
  34.  
  35. filepath=RESULT
  36.  
  37. pathf = DirOf(filepath)
  38. filef = FileOf(filepath)
  39.  
  40. RESULT=''
  41.  
  42. RequestStr PROMPT "Arguments"
  43.  
  44. argum=RESULT
  45.  
  46. ADDRESS COMMAND 'assign MYREXX: ' || '"' || pathf || '"'
  47. ADDRESS COMMAND 'rx >' outwin 'MYREXX:' || filef argum
  48. ADDRESS COMMAND 'assign MYREXX:'
  49.  
  50. CALL TellUser("Done")
  51.  
  52. EXIT 0
  53.  
  54. ReportError: PROCEDURE
  55.     PARSE ARG msg
  56.     BeepScreen
  57.     SetStatusBar TEMPORARY msg
  58.     RETURN
  59.  
  60.  
  61. TellUser: PROCEDURE
  62.     PARSE ARG msg
  63.     SetStatusBar TEMPORARY msg
  64.     RETURN
  65.  
  66. FileOf: PROCEDURE
  67.     PARSE ARG pathname
  68.     here = LastPos("/", pathname)
  69.     IF here = 0 THEN
  70.         here = LastPos(":", pathname)
  71.     IF here = 0 THEN
  72.         RETURN("")
  73.     ELSE
  74.         RETURN(SubStr(pathname, here+1))
  75.  
  76. DirOf: PROCEDURE
  77.     PARSE ARG pathname
  78.     here = LastPos("/", pathname)
  79.     IF here = 0 THEN
  80.         here = LastPos(":", pathname)
  81.     IF here = 0 THEN
  82.         RETURN("")
  83.     ELSE
  84.         RETURN(SubStr(pathname, 1, here))
  85.  
  86.  
  87.